/**
 * Copyright [2012] Jun Kato (arc@dmz)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import java.util.Date;
import java.util.GregorianCalendar;

public class SonyQ1 {

	public static void main(String[] args) {
		System.out.println(getTime(new Date().getTime(), 2000, 3, 12, 180));
	}

	/**
	 * Get the answer for Q1
	 * 
	 * @param now Current time in milliseconds
	 * @param a Year of your birth
	 * @param b Month of your birth
	 * @param c Day of month of your birth
	 * @param n Your life span
	 * @return Formatted text
	 * @see <a href="http://www.sony.co.jp/SonyInfo/Jobs/newgrads/sus/q01.html">Sony Japan GO FOR IT Q1</a>
	 */
	public static String getTime(long now, int a, int b, int c, int n) {
		long birthDate = new GregorianCalendar(a, b - 1, c).getTime().getTime();
		long deathDate = new GregorianCalendar(a + n, b - 1, c).getTime().getTime();
		int sec = (int) (24*3600*(now - birthDate) / (deathDate - birthDate));
		return String.format("%d時%d分%d秒", sec/3600, sec/60%60, sec%60);
	}
}